<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:p="http://primefaces.prime.com.tr/ui"
      xmlns:ui="http://java.sun.com/jsf/facelets">

    <h:head>
        <title>Compte Courant</title>
    </h:head>
    <h:body>

        <ui:composition template="./default.xhtml">

            <ui:define name="titrePage">
                Liste de comptes courant
            </ui:define>

            <ui:define name="partieGauche">
                <f:view>

                    <h:form  >


                        <p:dataTable var="item" paginator="true" rows="12" 
                                     value="#{compteBancaireMBean.afficherComptesEpargne}"
                                     >  
                            <f:facet name="header">    
                                <h3> Liste de comptes epargne </h3>
                                <p:outputPanel>
                                    <p:messages showDetail="true" id="research" globalOnly="true" autoUpdate="true"/>                                     
                                </p:outputPanel>
                            </f:facet> 

                            <p:column headerText="CompteID">
                                <f:facet name="header">
                                    <h:outputText value="ID"/>
                                </f:facet>
                                <h:commandLink action="#{compteBancaireMBean.showDetailsCompteEpargne(item)}" value="#{item.id}"/> 
                            </p:column>


                            <p:column headerText="CompteSolde"
                                      filterMatchMode="contains">
                                <f:facet name="header">
                                    <h:outputText value="Solde"/>
                                </f:facet>
                                <h:outputText value="#{item.soldeCompte}"/>
                            </p:column>

                            <p:column headerText="TYPE"
                                      filterMatchMode="contains">
                                <f:facet name="header">
                                    <h:outputText value="TYPE"/>
                                </f:facet>
                                <h:outputText value="#{item.type}"/>
                            </p:column>


                            <p:column>
                                <f:facet name="header">
                                    <h:outputText value="Date ouverture"/>
                                </f:facet>
                                <h:outputText value="#{item.dateOuverture}">
                                    <f:convertDateTime pattern="dd/MM/yyyy" />
                                </h:outputText>
                            </p:column>



                            <p:column style="text-align: center">
                                <f:facet name="header">
                                    <h:outputText value="Autre"/>
                                </f:facet>

                                <h:commandButton   action="#{compteBancaireMBean.supprimerCompte(item)}" image="./images/delete.png"/>
                            </p:column>


                        </p:dataTable>


                    </h:form>

                </f:view>
            </ui:define>

        </ui:composition>

    </h:body>
</html>















